//2009/08/10 01:23:07
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

class ClockWalk
{
public:
    int finalPosition(string flips)
    {
		int pos = 0;
		for(int i=0; i<flips.size(); i++)
		{
			if(flips[i] == 'h') pos = (pos + (i+1) + 12 * i) %12;
			else pos = (pos - (i+1) + 12 * i) % 12;
		}
		if(pos == 0) pos = 12;
		return pos;
    }
};
